<?php
require_once "OrderClass.php";
require_once "TrackStateClass.php";
require_once "vos/GetTrackerResultVO.php";

/**
* TrackClass 
*
* This class is designed to work with current orders -
*
* @author Victor Magarlamov <victor.magarlamov@gmail.com>
* @version 1.0
* @package presstrack
*/
 
class TrackClass 
{
	public $_explicitType = "presstrack.TrackClass";
    
	public $obOrder;
	
	public $obStateOfPapers;
	public $obStateOfImpos;
	public $obStateOfCtp;								
	public $obStateOfPress;
	public $obStateOfCut;
	public $obStateOfTermo;
	public $obStateOfTheisenHorizon;
	public $obStateOfLaminate;
	public $obStateOfStanz;
	public $obStateOfHand;
	public $obStateOfPack;	

	function __construct($idorder) 
	{
		$this->obStateOfPapers			 = new TrackStateClass();
		$this->obStateOfImpos			 = new TrackStateClass();
		$this->obStateOfCtp				 = new TrackStateClass();								
		$this->obStateOfPress			 = new TrackStateClass();
		$this->obStateOfCut				 = new TrackStateClass();
		$this->obStateOfTermo			 = new TrackStateClass();
		$this->obStateOfTheisenHorizon	 = new TrackStateClass();
		$this->obStateOfLaminate		 = new TrackStateClass();
		$this->obStateOfStanz			 = new TrackStateClass();
		$this->obStateOfHand			 = new TrackStateClass();
		$this->obStateOfPack			 = new TrackStateClass();
		
		$this->obOrder = new OrderClass($idorder, "", "");
		
		foreach ($this->obOrder->arGroup as $group)
		{
			foreach ($group->tasks as $task)
			{
				switch ($task->label) {
					case "бумага":
						$this->obStateOfPapers = new TrackStateClass();
						$this->obStateOfPapers->setFrom($task);
					break;
				
					case "спуск полос":
						$this->obStateOfImpos = new TrackStateClass();
						$this->obStateOfImpos->setFrom($task);
					break;
					
					case "вывод форм":
						$this->obStateOfCtp = new TrackStateClass();
						$this->obStateOfCtp->setFrom($task);
					break;
				
					case "печать":
						$this->obStateOfPress = new TrackStateClass();
						$this->obStateOfPress->setFrom($task);
					break;
				
					case "резка":
						$this->obStateOfCut = new TrackStateClass();
						$this->obStateOfCut->setFrom($task);
					break;
				
					case "скрепление":
						if (strpos($task->value, "термоклей") > 0)
						{
							$this->obStateOfTermo = new TrackStateClass();
							$this->obStateOfTermo->setFrom($task);
						}
						if (strpos($task->value, "скреп") > 0)
						{
							$this->obStateOfTheisenHorizon = new TrackStateClass();
							$this->obStateOfTheisenHorizon->setFrom($task);
						}
					break;
				
					case "ламинация":
						$this->obStateOfLaminate = new TrackStateClass();
						$this->obStateOfLaminate->setFrom($task);
					break;
					
					case "вырубка":
						$this->obStateOfStanz = new TrackStateClass();
						$this->obStateOfStanz->setFrom($task);
					break;
					
					case "ручные операции":
						$this->obStateOfHand = new TrackStateClass();
						$this->obStateOfHand->setFrom($task);
					break;
					
					case "упаковка":
						$this->obStateOfPack = new TrackStateClass();
						$this->obStateOfPack->setFrom($task);
					break;
				}
			}
		}
    }
}
?>